package com.fl.prestagil.activity;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.fl.prestagil.adapter.ViewPagerAdapter;
import com.fl.prestagil.databinding.ActivityIndexBinding;
import com.google.android.material.tabs.TabLayoutMediator;

public class IndexActivity extends AppCompatActivity {
    private ActivityIndexBinding binding;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityIndexBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        ViewPagerAdapter adapter = new ViewPagerAdapter(this);
        binding.viewPager.setAdapter(adapter);

        new TabLayoutMediator(binding.tabLayout, binding.viewPager, (tab, position) -> {
            switch (position) {
                case 0:
                    tab.setText("Casa");
                    break;
                case 1:
                    tab.setText("Factura");
                    break;
                case 2:
                    tab.setText("Usuario");
                    break;
                default:
                    tab.setText(null);
            }
        }).attach();
    }
}
